// components/record-card/record-card.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    recordType: {
      type: String,
      value: '血压记录',
      observer: function(newVal) {
        this.setData({
          cardType: newVal === '血压记录' ? 'blood-pressure' : 'medication'
        });
      }
    },
    recordTime: {
      type: String,
      value: ''
    },
    systolic: {
      type: Number,
      value: 0
    },
    diastolic: {
      type: Number,
      value: 0
    },
    heartRate: {
      type: Number,
      value: 0
    },
    medicationName: {
      type: String,
      value: '降压药'
    },
    status: {
      type: String,
      value: 'taken'
    },
    notes: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    cardType: 'blood-pressure'
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 可以添加点击事件等交互方法
    onCardClick() {
      this.triggerEvent('cardclick', {
        recordType: this.data.recordType,
        recordTime: this.data.recordTime
      });
    }
  }
})